<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>{$site_name}</title>
    <!-- CSS -->
    <link rel="stylesheet" href="{url:#css/materialize.min.css}"/>
    <link rel="stylesheet" href="{url:#css/me.css}"/>
    <link rel="stylesheet" href="{url:#css/iconfont.css}"/>

    <style type="text/css">
        /**去除绿色下划线 - 开始*/
        input::-webkit-input-placeholder {
            color: #7e7e7e;
            text-indent: 5px;
        }

        input:not([type]), input[type=text], input[type=password], input[type=email], input[type=url], input[type=time], input[type=date], input[type=datetime-local], input[type=tel], input[type=number], input[type=search], textarea.materialize-textarea {
            background-color: transparent;
            border: none;
            border-radius: 0;
            outline: none;
            height: 1.5em;
            width: 100%;
            font-size: 1rem;
            margin: 0;
            padding: 0;
            box-shadow: none;
        }

        input:not([type]):focus:not([readonly]), input[type=text]:focus:not([readonly]), input[type=password]:focus:not([readonly]), input[type=email]:focus:not([readonly]), input[type=url]:focus:not([readonly]), input[type=time]:focus:not([readonly]), input[type=date]:focus:not([readonly]), input[type=datetime-local]:focus:not([readonly]), input[type=tel]:focus:not([readonly]), input[type=number]:focus:not([readonly]), input[type=search]:focus:not([readonly]), textarea.materialize-textarea:focus:not([readonly]) {
            border-bottom: none;
            box-shadow: none
        }

        /**去除绿色下划线 - 结束*/
        .q-ltitle {
            height: 37px;
            line-height: 37px;
            vertical-align: middle;
            font-family: "微软雅黑";
            font-size: 16px;
            text-align: center;
        }
    </style>
    <!-- JS -->
    <script src="{url:#js/jquery-1.11.3.min.js}"></script>
    <script src="{url:#js/materialize.min.js}"></script>
    <script src="{url:#js/home/register.js}"></script>
    <script src="{url:#js/yang_check.js}"></script>
</head>
<body class="q-body">
<!-- TitleBar 开始 -->
<div class="navbar-fixed">
    <nav>
        <div class="nav-wrapper red accent-4 valign-wrapper">
            <ul class="left" id="nav-btn-left">
                <li><a href="{url:/mobile/user_center}"><i class="iconfont">&#xe63c;</i></a></li>
            </ul>
            <span class="title-bar-size center_align">购券</span>
            <ul class="right">
                <li><a class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
            </ul>
        </div>
    </nav>
</div>
<!-- TitleBar 结束 -->

<div class="container" style="padding-top: 30px;">

        

        

        
        
        
        <div class="row">
            <div class="col s4 q-ltitle">购买方式：</div>
            <div class="col s7">
                <select class="browser-default" name="zh_type" id="zh_type" onchange="sel_change_txt()" style="margin-left:-10px;">
                	<option value="0">账户余额 购买 消费券</option>
					<option value="1">通用积分 购买 消费券</option>
					<!-- 
					<option value="2">通用积分 兑换 可用积分</option>
					<option value="3">可用积分 兑换 通用积分</option>
					-->
                </select>
            </div>
        </div>
        <!-- 
        <div class="row">
            <div class="col s4 q-ltitle">&nbsp;</div>
            <div class="col s7">
                	<span id="sp_msg" style="color:red;">兑换比例 1:1</span>
            </div>
        </div>
        -->
        
        <div class="row">
            <div class="col s4 q-ltitle">购买金额：</div>
            <div class="col s7">
                <input name="zh_amount" id="zh_amount" type="text" placeholder="最低金额不小于1"
                       style="border:1px solid #ccc;padding:10px; margin-left:-10px;height: 15px;"/>
            </div>
        </div>
        
        <div class="row">
            <div class="col s4 q-ltitle">交易密码：</div>
            <div class="col s7">
                <input name="pass2" id="pass2" type="password" placeholder="请输入交易密码"
                       style="border:1px solid #ccc;padding:10px; margin-left:-10px;height: 15px;"/>
            </div>
        </div>

        <div class="center clearfix" style="margin-right:10px; margin-left:10px;margin-top:60px;">
        <!-- 
                    <a class="waves-effect waves-light btn-large red z-depth-0 login_btn">提交申请</a>
        -->
        <input type="hidden" id="user_id" name="user_id" value="{$mobile_user[id]}"/>
            <input type="button" id="btn_zh" value="提交" onclick="sub()" class="waves-effect waves-light btn-large red z-depth-0 login_btn"/>
        </div>
    
</div>


<script type="text/javascript">



function sel_change_txt()
{
	/*
	var zh_type = $("#zh_type").val();
	if(zh_type == 3)
	{		
		$("#sp_msg").text('兑换比例 1:0.85');
		$("#zh_amount").attr("placeholder","至少100且为100的倍数");
	}
	else
	{
		$("#sp_msg").text('兑换比例 1:1');
		$("#zh_amount").attr("placeholder","最低金额不小于1");
	}
	*/
}

function sub()
{
	var user_id = $("#user_id").val();
	var zh_type = $("#zh_type").val();
	var zh_amount = $.trim($("#zh_amount").val());
	var pass2    =$.trim($("#pass2").val());
	/*
	if(zh_type == 3)
	{
		if(isNaN(zh_amount) || zh_amount < 100 || zh_amount % 100 !=0)
		{
			yang_alert("金额需大于等于100且为100的倍数");
			return;
		}
	}
	else
	{
		if(isNaN(zh_amount) || zh_amount < 1)
		{
			yang_alert("金额必须为数字，且大于等于1");
			return;
		}
	}
	*/
	
	if(isNaN(zh_amount) || zh_amount < 1)
	{
		yang_alert("金额必须为数字，且大于等于1");
		return;
	}
	
	if(pass2 == '')
	{
		yang_alert('交易密码不能为空');
		return;
	}
	
	
	$("#btn_zh").attr("disabled", true);
	
	$.post("{url:/mobile/gq_do}",{user_id:user_id,zh_type:zh_type,pass2:pass2,amount:zh_amount},function(data){
		if(data['status']=='success')
		{
			yang_alert(data['msg']);
			//重新加载本页面
			document.location.href = document.location.href;
		}
		else
		{
			yang_alert(data['msg']);
			$("#btn_zh").attr("disabled", false);
		}
	},'json');
}


</script>
</body>
</html>
